



<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#FFF">
  <link rel="apple-touch-icon" sizes="180x180" href="/blog/images/apple-touch-icon.png">

<link rel="icon" type="image/ico" sizes="32x32" href="/blog/images/favicon.ico">
  <meta http-equiv="Cache-Control" content="no-transform">
  <meta http-equiv="Cache-Control" content="no-siteapp">


<link rel="alternate" type="application/rss+xml" title="凡尘一叶" href="http://fyduyu.gitee.io/blog/rss.xml" />
<link rel="alternate" type="application/atom+xml" title="凡尘一叶" href="http://fyduyu.gitee.io/blog/atom.xml" />
<link rel="alternate" type="application/json" title="凡尘一叶" href="http://fyduyu.gitee.io/blog/feed.json" />

<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Mulish:300,300italic,400,400italic,700,700italic%7CFredericka%20the%20Great:300,300italic,400,400italic,700,700italic%7CNoto%20Serif%20JP:300,300italic,400,400italic,700,700italic%7CNoto%20Serif%20SC:300,300italic,400,400italic,700,700italic%7CInconsolata:300,300italic,400,400italic,700,700italic&display=swap&subset=latin,latin-ext">

<link rel="stylesheet" href="/blog/css/app.css?v=0.2.5">

  
  <meta name="keywords" content="分布式" />


<link rel="canonical" href="http://fyduyu.gitee.io/blog/2020/12/24/Spring%20Config+Bus/">



  <title>
Spring Config+Bus - SpringCloud |
blog = 凡尘一叶</title>
<meta name="generator" content="Hexo 5.3.0"></head>
<body itemscope itemtype="http://schema.org/WebPage">
  <div id="loading">
    <div class="cat">
      <div class="body"></div>
      <div class="head">
        <div class="face"></div>
      </div>
      <div class="foot">
        <div class="tummy-end"></div>
        <div class="bottom"></div>
        <div class="legs left"></div>
        <div class="legs right"></div>
      </div>
      <div class="paw">
        <div class="hands left"></div>
        <div class="hands right"></div>
      </div>
    </div>
  </div>
  <div id="container">
    <header id="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="inner">
        <div id="brand">
          <div class="pjax">
          
  <h1 itemprop="name headline">Spring Config+Bus
  </h1>
  
<div class="meta">
  <span class="item" title="创建时间：2020-12-24 19:09:53">
    <span class="icon">
      <i class="ic i-calendar"></i>
    </span>
    <span class="text">发表于</span>
    <time itemprop="dateCreated datePublished" datetime="2020-12-24T19:09:53+08:00">2020-12-24</time>
  </span>
  <span class="item" title="本文字数">
    <span class="icon">
      <i class="ic i-pen"></i>
    </span>
    <span class="text">本文字数</span>
    <span>3.6k</span>
    <span class="text">字</span>
  </span>
  <span class="item" title="阅读时长">
    <span class="icon">
      <i class="ic i-clock"></i>
    </span>
    <span class="text">阅读时长</span>
    <span>3 分钟</span>
  </span>
</div>


          </div>
        </div>
        <nav id="nav">
  <div class="inner">
    <div class="toggle">
      <div class="lines" aria-label="切换导航栏">
        <span class="line"></span>
        <span class="line"></span>
        <span class="line"></span>
      </div>
    </div>
    <ul class="menu">
      <li class="item title"><a href="/blog/" rel="start">blog</a></li>
    </ul>
    <ul class="right">
      <li class="item theme">
        <i class="ic i-sun"></i>
      </li>
      <li class="item search">
        <i class="ic i-search"></i>
      </li>
    </ul>
  </div>
</nav>

      </div>
      <div id="imgs" class="pjax">
        <ul>
          <li class="item" data-background-image="https://tva4.sinaimg.cn/large/6833939bly1gicivghyooj20zk0m8dir.jpg"></li>
          <li class="item" data-background-image="https://tva4.sinaimg.cn/large/6833939bly1gipesng5oej20zk0m87d4.jpg"></li>
          <li class="item" data-background-image="https://tva4.sinaimg.cn/large/6833939bly1gipeudstjqj20zk0m8k3r.jpg"></li>
          <li class="item" data-background-image="https://tva4.sinaimg.cn/large/6833939bly1giciundwu5j20zk0m8n9e.jpg"></li>
          <li class="item" data-background-image="https://tva4.sinaimg.cn/large/6833939bly1gicli9lfebj20zk0m84qp.jpg"></li>
          <li class="item" data-background-image="https://tva4.sinaimg.cn/large/6833939bly1giclffsa1cj20zk0m811l.jpg"></li>
        </ul>
      </div>
    </header>
    <div id="waves">
      <svg class="waves" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 24 150 28" preserveAspectRatio="none" shape-rendering="auto">
        <defs>
          <path id="gentle-wave" d="M-160 44c30 0 58-18 88-18s 58 18 88 18 58-18 88-18 58 18 88 18 v44h-352z" />
        </defs>
        <g class="parallax">
          <use xlink:href="#gentle-wave" x="48" y="0" />
          <use xlink:href="#gentle-wave" x="48" y="3" />
          <use xlink:href="#gentle-wave" x="48" y="5" />
          <use xlink:href="#gentle-wave" x="48" y="7" />
        </g>
      </svg>
    </div>
    <main>
      <div class="inner">
        <div id="main" class="pjax">
          
  <div class="article wrap">
    
<div class="breadcrumb" itemscope itemtype="https://schema.org/BreadcrumbList">
<i class="ic i-home"></i>
<span><a href="/blog/">首页</a></span><i class="ic i-angle-right"></i>
<span  class="current" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem"><a href="/blog/categories/SpringCloud/" itemprop="item" rel="index" title="分类于 SpringCloud"><span itemprop="name">SpringCloud</span></a>
<meta itemprop="position" content="1" /></span>
</div>

    <article itemscope itemtype="http://schema.org/Article" class="post block" lang="zh-CN">
  <link itemprop="mainEntityOfPage" href="http://fyduyu.gitee.io/blog/2020/12/24/Spring%20Config+Bus/">

  <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
    <meta itemprop="image" content="/blog/images/touxiang.jpg">
    <meta itemprop="name" content="杜朝宇">
    <meta itemprop="description" content=", 个人博客&编程笔记">
  </span>

  <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
    <meta itemprop="name" content="凡尘一叶">
  </span>

  <div class="body md" itemprop="articleBody">
    

    <h1 id="spring-config分布式配置中心"><a class="markdownIt-Anchor" href="#spring-config分布式配置中心">#</a> Spring Config 分布式配置中心</h1>
<p><mark>微服务面临的问题</mark></p>
<p>可以看到，每个微服务都需要一个配置文件，并且，如果有几个微服务都需要连接数据库<br>
那么就需要配 4 次数据库相关配置，并且当数据库发生改动，那么需要同时修改 4 个微服务的配置文件才可以</p>
<p>所以有了 springconfig 配置中心</p>
<h1 id="使用配置中心"><a class="markdownIt-Anchor" href="#使用配置中心">#</a> 使用配置中心:</h1>
<h2 id="使用码云作为配置中心的仓库"><a class="markdownIt-Anchor" href="#使用码云作为配置中心的仓库">#</a> 使用码云作为配置中心的仓库:</h2>
<h3 id="初始化git环境"><a class="markdownIt-Anchor" href="#初始化git环境">#</a> 初始化 git 环境:</h3>
<p>在码云上创建一个名为 springcloud-config 的仓库</p>
<h3 id="新建config模块"><a class="markdownIt-Anchor" href="#新建config模块">#</a> 新建 config 模块:</h3>
<p>名字:   cloud-config-3344</p>
<h3 id="pom"><a class="markdownIt-Anchor" href="#pom">#</a> pom</h3>
<figure class="highlight xml"><figcaption data-lang="XML"></figcaption><table><tr><td data-num="1"></td><td><pre><span class="token comment">&lt;!--config server--></span></pre></td></tr><tr><td data-num="2"></td><td><pre><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>dependency</span><span class="token punctuation">></span></span></pre></td></tr><tr><td data-num="3"></td><td><pre>    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>groupId</span><span class="token punctuation">></span></span>org.springframework.cloud<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>groupId</span><span class="token punctuation">></span></span></pre></td></tr><tr><td data-num="4"></td><td><pre>    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>artifactId</span><span class="token punctuation">></span></span>spring-cloud-config-server<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>artifactId</span><span class="token punctuation">></span></span></pre></td></tr><tr><td data-num="5"></td><td><pre><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>dependency</span><span class="token punctuation">></span></span></pre></td></tr></table></figure><h3 id="配置文件"><a class="markdownIt-Anchor" href="#配置文件">#</a> 配置文件</h3>
<p>仓库为私有的需要设置密码</p>
<figure class="highlight yaml"><figcaption data-lang="YAML"></figcaption><table><tr><td data-num="1"></td><td><pre><span class="token key atrule">server</span><span class="token punctuation">:</span></pre></td></tr><tr><td data-num="2"></td><td><pre>  <span class="token key atrule">port</span><span class="token punctuation">:</span> <span class="token number">3344</span></pre></td></tr><tr><td data-num="3"></td><td><pre></pre></td></tr><tr><td data-num="4"></td><td><pre><span class="token key atrule">spring</span><span class="token punctuation">:</span></pre></td></tr><tr><td data-num="5"></td><td><pre>  <span class="token key atrule">application</span><span class="token punctuation">:</span></pre></td></tr><tr><td data-num="6"></td><td><pre>    <span class="token key atrule">name</span><span class="token punctuation">:</span> cloud<span class="token punctuation">-</span>config<span class="token punctuation">-</span>center</pre></td></tr><tr><td data-num="7"></td><td><pre>  <span class="token key atrule">cloud</span><span class="token punctuation">:</span></pre></td></tr><tr><td data-num="8"></td><td><pre>    <span class="token key atrule">config</span><span class="token punctuation">:</span></pre></td></tr><tr><td data-num="9"></td><td><pre>      <span class="token key atrule">server</span><span class="token punctuation">:</span></pre></td></tr><tr><td data-num="10"></td><td><pre>        <span class="token key atrule">git</span><span class="token punctuation">:</span></pre></td></tr><tr><td data-num="11"></td><td><pre>          <span class="token key atrule">uri</span><span class="token punctuation">:</span> https<span class="token punctuation">:</span>//gitee.com/fyduyu/springcloud<span class="token punctuation">-</span>config <span class="token comment">#码云上面仓亏的地址</span></pre></td></tr><tr><td data-num="12"></td><td><pre>          <span class="token key atrule">search-paths</span><span class="token punctuation">:</span></pre></td></tr><tr><td data-num="13"></td><td><pre>            <span class="token punctuation">-</span> springcloud<span class="token punctuation">-</span>config</pre></td></tr><tr><td data-num="14"></td><td><pre>          <span class="token key atrule">username</span><span class="token punctuation">:</span> 码云账号</pre></td></tr><tr><td data-num="15"></td><td><pre>          <span class="token key atrule">password</span><span class="token punctuation">:</span> 码云密码</pre></td></tr><tr><td data-num="16"></td><td><pre>      <span class="token key atrule">label</span><span class="token punctuation">:</span> master</pre></td></tr><tr><td data-num="17"></td><td><pre></pre></td></tr><tr><td data-num="18"></td><td><pre><span class="token key atrule">eureka</span><span class="token punctuation">:</span></pre></td></tr><tr><td data-num="19"></td><td><pre>  <span class="token key atrule">client</span><span class="token punctuation">:</span></pre></td></tr><tr><td data-num="20"></td><td><pre>    <span class="token key atrule">service-url</span><span class="token punctuation">:</span></pre></td></tr><tr><td data-num="21"></td><td><pre>      <span class="token key atrule">defaultZone</span><span class="token punctuation">:</span> http<span class="token punctuation">:</span>//localhost<span class="token punctuation">:</span>7001/eureka</pre></td></tr></table></figure><h3 id="主启动类"><a class="markdownIt-Anchor" href="#主启动类">#</a> 主启动类</h3>
<figure class="highlight java"><figcaption data-lang="java"></figcaption><table><tr><td data-num="1"></td><td><pre><span class="token annotation punctuation">@SpringBootApplication</span></pre></td></tr><tr><td data-num="2"></td><td><pre><span class="token annotation punctuation">@EnableConfigServer</span></pre></td></tr></table></figure><h3 id="配置完成"><a class="markdownIt-Anchor" href="#配置完成">#</a> 配置完成</h3>
<p>测试，3344 是否可以从 github 上获取配置</p>
<p>启动 3344	(要先启动 eureka)</p>
<p>它实际上就是，读取到配置文件中的码云的地址，然后拼接上 /master/config-dev.yml</p>
<h1 id="创建配置中心客户端"><a class="markdownIt-Anchor" href="#创建配置中心客户端">#</a> 创建配置中心客户端:</h1>
<h2 id="创建config客户端项目"><a class="markdownIt-Anchor" href="#创建config客户端项目">#</a> 创建 config 客户端项目</h2>
<p>名字: 	cloud-config-client-3355</p>
<h2 id="pom-2"><a class="markdownIt-Anchor" href="#pom-2">#</a> pom</h2>
<figure class="highlight xml"><figcaption data-lang="XML"></figcaption><table><tr><td data-num="1"></td><td><pre><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>dependency</span><span class="token punctuation">></span></span></pre></td></tr><tr><td data-num="2"></td><td><pre>        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>groupId</span><span class="token punctuation">></span></span>org.springframework.cloud<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>groupId</span><span class="token punctuation">></span></span></pre></td></tr><tr><td data-num="3"></td><td><pre>        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>artifactId</span><span class="token punctuation">></span></span>spring-cloud-starter-config<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>artifactId</span><span class="token punctuation">></span></span></pre></td></tr><tr><td data-num="4"></td><td><pre>    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>dependency</span><span class="token punctuation">></span></span></pre></td></tr></table></figure><h2 id="配置文件-2"><a class="markdownIt-Anchor" href="#配置文件-2">#</a> 配置文件</h2>
<figure class="highlight yaml"><figcaption data-lang="YAML"></figcaption><table><tr><td data-num="1"></td><td><pre><span class="token key atrule">server</span><span class="token punctuation">:</span></pre></td></tr><tr><td data-num="2"></td><td><pre>  <span class="token key atrule">port</span><span class="token punctuation">:</span> <span class="token number">3355</span></pre></td></tr><tr><td data-num="3"></td><td><pre><span class="token key atrule">spring</span><span class="token punctuation">:</span></pre></td></tr><tr><td data-num="4"></td><td><pre>  <span class="token key atrule">application</span><span class="token punctuation">:</span></pre></td></tr><tr><td data-num="5"></td><td><pre>    <span class="token key atrule">name</span><span class="token punctuation">:</span> config<span class="token punctuation">-</span>client</pre></td></tr><tr><td data-num="6"></td><td><pre>  <span class="token key atrule">cloud</span><span class="token punctuation">:</span></pre></td></tr><tr><td data-num="7"></td><td><pre>    <span class="token key atrule">config</span><span class="token punctuation">:</span></pre></td></tr><tr><td data-num="8"></td><td><pre>      <span class="token key atrule">label</span><span class="token punctuation">:</span> master</pre></td></tr><tr><td data-num="9"></td><td><pre>      <span class="token key atrule">name</span><span class="token punctuation">:</span> config</pre></td></tr><tr><td data-num="10"></td><td><pre>      <span class="token key atrule">profile</span><span class="token punctuation">:</span> test</pre></td></tr><tr><td data-num="11"></td><td><pre>      <span class="token key atrule">uri</span><span class="token punctuation">:</span> http<span class="token punctuation">:</span>//localhost<span class="token punctuation">:</span><span class="token number">3344</span></pre></td></tr><tr><td data-num="12"></td><td><pre>      <span class="token comment">#这里会读取 http://localhost:3344/master/config-test.yml 的配置文件</span></pre></td></tr><tr><td data-num="13"></td><td><pre><span class="token key atrule">eureka</span><span class="token punctuation">:</span></pre></td></tr><tr><td data-num="14"></td><td><pre>  <span class="token key atrule">client</span><span class="token punctuation">:</span></pre></td></tr><tr><td data-num="15"></td><td><pre>    <span class="token key atrule">service-url</span><span class="token punctuation">:</span></pre></td></tr><tr><td data-num="16"></td><td><pre>      <span class="token key atrule">defaultZone</span><span class="token punctuation">:</span> http<span class="token punctuation">:</span>//localhost<span class="token punctuation">:</span>7001/eureka</pre></td></tr></table></figure><h2 id="主启动类-2"><a class="markdownIt-Anchor" href="#主启动类-2">#</a> 主启动类</h2>
<figure class="highlight java"><figcaption data-lang="java"></figcaption><table><tr><td data-num="1"></td><td><pre><span class="token annotation punctuation">@SpringBootApplication</span></pre></td></tr><tr><td data-num="2"></td><td><pre><span class="token annotation punctuation">@EnableEurekaClient</span></pre></td></tr></table></figure><h2 id="controller类"><a class="markdownIt-Anchor" href="#controller类">#</a> controller 类</h2>
<p>以 rest 风格将配置对外暴露</p>
<figure class="highlight yaml"><figcaption data-lang="YAML"></figcaption><table><tr><td data-num="1"></td><td><pre>@RestController</pre></td></tr><tr><td data-num="2"></td><td><pre>public class ConfigClientController <span class="token punctuation">&#123;</span></pre></td></tr><tr><td data-num="3"></td><td><pre>    @Value("$<span class="token punctuation">&#123;</span>config.info<span class="token punctuation">&#125;</span>")</pre></td></tr><tr><td data-num="4"></td><td><pre>    private String configInfo;</pre></td></tr><tr><td data-num="5"></td><td><pre></pre></td></tr><tr><td data-num="6"></td><td><pre>    @GetMapping("configInfo")</pre></td></tr><tr><td data-num="7"></td><td><pre>    public String getConfigInfo()<span class="token punctuation">&#123;</span></pre></td></tr><tr><td data-num="8"></td><td><pre>        return configInfo;</pre></td></tr><tr><td data-num="9"></td><td><pre>    <span class="token punctuation">&#125;</span></pre></td></tr><tr><td data-num="10"></td><td><pre><span class="token punctuation">&#125;</span></pre></td></tr></table></figure><h2 id="测试"><a class="markdownIt-Anchor" href="#测试">#</a> 测试</h2>
<p>启动 3344,3355</p>
<p>​	访问 3355 的  /configInfo</p>
<p><span class="exturl" data-url="aHR0cDovL2xvY2FsaG9zdDozMzU1L2NvbmZpZ0luZm8=">http://localhost:3355/configInfo</span></p>
<p>上面 3355 确实获取到了配置文件，但是如果此时配置文件修改了，3355 是获取不到的<br>
 3344 可以实时获取到最新配置文件，但是 3355 却获取不到<br>
除非重启服务</p>
<h2 id="实现动态刷新"><a class="markdownIt-Anchor" href="#实现动态刷新">#</a> 实现动态刷新</h2>
<h3 id="修改3355添加一个pom依赖"><a class="markdownIt-Anchor" href="#修改3355添加一个pom依赖">#</a> 修改 3355, 添加一个 pom 依赖</h3>
<figure class="highlight xml"><figcaption data-lang="XML"></figcaption><table><tr><td data-num="1"></td><td><pre><span class="token comment">&lt;!-- 监控 --></span></pre></td></tr><tr><td data-num="2"></td><td><pre><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>dependency</span><span class="token punctuation">></span></span></pre></td></tr><tr><td data-num="3"></td><td><pre>    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>groupId</span><span class="token punctuation">></span></span>org.springframework.boot<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>groupId</span><span class="token punctuation">></span></span></pre></td></tr><tr><td data-num="4"></td><td><pre>    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>artifactId</span><span class="token punctuation">></span></span>spring-boot-starter-actuator<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>artifactId</span><span class="token punctuation">></span></span></pre></td></tr><tr><td data-num="5"></td><td><pre><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>dependency</span><span class="token punctuation">></span></span></pre></td></tr></table></figure><h3 id="修改配置文件添加一个配置"><a class="markdownIt-Anchor" href="#修改配置文件添加一个配置">#</a> 修改配置文件，添加一个配置</h3>
<figure class="highlight yaml"><figcaption data-lang="YAML"></figcaption><table><tr><td data-num="1"></td><td><pre><span class="token comment"># 暴力监控端点</span></pre></td></tr><tr><td data-num="2"></td><td><pre><span class="token key atrule">management</span><span class="token punctuation">:</span></pre></td></tr><tr><td data-num="3"></td><td><pre>  <span class="token key atrule">endpoints</span><span class="token punctuation">:</span></pre></td></tr><tr><td data-num="4"></td><td><pre>    <span class="token key atrule">web</span><span class="token punctuation">:</span></pre></td></tr><tr><td data-num="5"></td><td><pre>      <span class="token key atrule">exposure</span><span class="token punctuation">:</span></pre></td></tr><tr><td data-num="6"></td><td><pre>        <span class="token key atrule">include</span><span class="token punctuation">:</span> <span class="token string">"*"</span></pre></td></tr></table></figure><h3 id="修改controller"><a class="markdownIt-Anchor" href="#修改controller">#</a> 修改 controller</h3>
<figure class="highlight java"><figcaption data-lang="java"></figcaption><table><tr><td data-num="1"></td><td><pre><span class="token annotation punctuation">@RefreshScope</span></pre></td></tr></table></figure><h3 id="此时重启服务"><a class="markdownIt-Anchor" href="#此时重启服务">#</a> 此时重启服务</h3>
<p>此时 3355 还不可以动态获取</p>
<p>因为此时，还需要<mark>外部</mark>发送 post 请求通知 3355</p>
<figure class="highlight java"><figcaption data-lang="java"></figcaption><table><tr><td data-num="1"></td><td><pre>curl <span class="token operator">-</span><span class="token class-name">X</span> POST <span class="token string">"localhost:3355/actuator/refresh"</span></pre></td></tr></table></figure><p>此时在刷新 3355, 发现可以获取到最新的配置文件了，这就实现了动态获取配置文件，因为 3355 并没有重启</p>
<p>具体流程就是:</p>
<p>​			我们启动好服务后</p>
<p>​			运维人员，修改了配置文件，然后发送一个 post 请求通知 3355</p>
<p>​			3355 就可以获取最新配置文件</p>
<ul>
<li>问题:</li>
</ul>
<p>​		如果有多个客户端怎么办 (3355,3356,3357…)</p>
<p>​						虽然可以使用 shell 脚本，循环刷新</p>
<p>​		但是，可不可以使用广播，一次通知？？</p>
<p>​					这些 springconfig 做不到，需要使用 springcloud Bus 消息总线</p>
<h1 id="消息总线"><a class="markdownIt-Anchor" href="#消息总线">#</a> 消息总线:</h1>
<h2 id="使用springcloud-bus"><a class="markdownIt-Anchor" href="#使用springcloud-bus">#</a> 使用 SpringCloud Bus</h2>
<ul>
<li>
<p>配置 rabbitmq 环境</p>
</li>
<li>
<p>之前只有一个配置中心客户端，这里在创建一个 **</p>
</li>
<li>
<p>使用 Bus 实现全局广播</p>
</li>
</ul>
<p>Bus 广播有两种方式:</p>
<p>一种是用消息总线触发一个客户端，从而刷新所有的客户端的配置</p>
<p>一种是用消息总线触发服务端，从而刷新所有的客户端的配置</p>
<p>这两种方式，第二种跟合适</p>
<h2 id="配置"><a class="markdownIt-Anchor" href="#配置">#</a> 配置</h2>
<h3 id="配置3344配置中心服务端"><a class="markdownIt-Anchor" href="#配置3344配置中心服务端">#</a> 配置 3344 (配置中心服务端)</h3>
<h4 id="添加pom"><a class="markdownIt-Anchor" href="#添加pom">#</a> 添加 pom</h4>
<p>springboot 的监控组件，和消息总线</p>
<figure class="highlight xml"><figcaption data-lang="XML"></figcaption><table><tr><td data-num="1"></td><td><pre><span class="token comment">&lt;!-- 添加消息总线 RabbitMQ 支持 --></span></pre></td></tr><tr><td data-num="2"></td><td><pre>        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>dependency</span><span class="token punctuation">></span></span></pre></td></tr><tr><td data-num="3"></td><td><pre>            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>groupId</span><span class="token punctuation">></span></span>org.springframework.cloud<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>groupId</span><span class="token punctuation">></span></span></pre></td></tr><tr><td data-num="4"></td><td><pre>            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>artifactId</span><span class="token punctuation">></span></span>spring-cloud-starter-bus-amqp<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>artifactId</span><span class="token punctuation">></span></span></pre></td></tr><tr><td data-num="5"></td><td><pre>        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>dependency</span><span class="token punctuation">></span></span></pre></td></tr><tr><td data-num="6"></td><td><pre>        <span class="token comment">&lt;!-- 监控 --></span></pre></td></tr><tr><td data-num="7"></td><td><pre>        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>dependency</span><span class="token punctuation">></span></span></pre></td></tr><tr><td data-num="8"></td><td><pre>            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>groupId</span><span class="token punctuation">></span></span>org.springframework.boot<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>groupId</span><span class="token punctuation">></span></span></pre></td></tr><tr><td data-num="9"></td><td><pre>            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>artifactId</span><span class="token punctuation">></span></span>spring-boot-starter-actuator<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>artifactId</span><span class="token punctuation">></span></span></pre></td></tr><tr><td data-num="10"></td><td><pre>        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>dependency</span><span class="token punctuation">></span></span></pre></td></tr></table></figure><h4 id="修改服务端配置文件"><a class="markdownIt-Anchor" href="#修改服务端配置文件">#</a> 修改服务端配置文件</h4>
<figure class="highlight yaml"><figcaption data-lang="YAML"></figcaption><table><tr><td data-num="1"></td><td><pre><span class="token key atrule">spring</span><span class="token punctuation">:</span></pre></td></tr><tr><td data-num="2"></td><td><pre>  <span class="token key atrule">rabbitmq</span><span class="token punctuation">:</span></pre></td></tr><tr><td data-num="3"></td><td><pre>    <span class="token key atrule">host</span><span class="token punctuation">:</span> localhost</pre></td></tr><tr><td data-num="4"></td><td><pre>    <span class="token key atrule">port</span><span class="token punctuation">:</span> <span class="token number">5672</span></pre></td></tr><tr><td data-num="5"></td><td><pre>    <span class="token key atrule">username</span><span class="token punctuation">:</span> guest</pre></td></tr><tr><td data-num="6"></td><td><pre>    <span class="token key atrule">password</span><span class="token punctuation">:</span> guest</pre></td></tr><tr><td data-num="7"></td><td><pre><span class="token key atrule">management</span><span class="token punctuation">:</span></pre></td></tr><tr><td data-num="8"></td><td><pre>  <span class="token key atrule">endpoints</span><span class="token punctuation">:</span></pre></td></tr><tr><td data-num="9"></td><td><pre>    <span class="token key atrule">web</span><span class="token punctuation">:</span></pre></td></tr><tr><td data-num="10"></td><td><pre>      <span class="token key atrule">exposure</span><span class="token punctuation">:</span></pre></td></tr><tr><td data-num="11"></td><td><pre>        <span class="token key atrule">include</span><span class="token punctuation">:</span> <span class="token string">'bus-refresh'</span></pre></td></tr></table></figure><h3 id="修改客户端配置文件"><a class="markdownIt-Anchor" href="#修改客户端配置文件">#</a> 修改客户端配置文件</h3>
<h4 id="添加pom-2"><a class="markdownIt-Anchor" href="#添加pom-2">#</a> 添加 pom</h4>
<figure class="highlight xml"><figcaption data-lang="XML"></figcaption><table><tr><td data-num="1"></td><td><pre><span class="token comment">&lt;!-- 添加消息总线 RabbitMQ 支持 --></span></pre></td></tr><tr><td data-num="2"></td><td><pre>        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>dependency</span><span class="token punctuation">></span></span></pre></td></tr><tr><td data-num="3"></td><td><pre>            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>groupId</span><span class="token punctuation">></span></span>org.springframework.cloud<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>groupId</span><span class="token punctuation">></span></span></pre></td></tr><tr><td data-num="4"></td><td><pre>            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>artifactId</span><span class="token punctuation">></span></span>spring-cloud-starter-bus-amqp<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>artifactId</span><span class="token punctuation">></span></span></pre></td></tr><tr><td data-num="5"></td><td><pre>        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>dependency</span><span class="token punctuation">></span></span></pre></td></tr><tr><td data-num="6"></td><td><pre>        <span class="token comment">&lt;!-- 监控 --></span></pre></td></tr><tr><td data-num="7"></td><td><pre>        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>dependency</span><span class="token punctuation">></span></span></pre></td></tr><tr><td data-num="8"></td><td><pre>            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>groupId</span><span class="token punctuation">></span></span>org.springframework.boot<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>groupId</span><span class="token punctuation">></span></span></pre></td></tr><tr><td data-num="9"></td><td><pre>            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>artifactId</span><span class="token punctuation">></span></span>spring-boot-starter-actuator<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>artifactId</span><span class="token punctuation">></span></span></pre></td></tr><tr><td data-num="10"></td><td><pre>        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>dependency</span><span class="token punctuation">></span></span></pre></td></tr></table></figure><h4 id="配置文件-3"><a class="markdownIt-Anchor" href="#配置文件-3">#</a> 配置文件</h4>
<p><mark>注意配置文件的名字，要改为 bootstrap.yml</mark></p>
<figure class="highlight yaml"><figcaption data-lang="YAML"></figcaption><table><tr><td data-num="1"></td><td><pre><span class="token key atrule">spring</span><span class="token punctuation">:</span></pre></td></tr><tr><td data-num="2"></td><td><pre>  <span class="token key atrule">rabbitmq</span><span class="token punctuation">:</span></pre></td></tr><tr><td data-num="3"></td><td><pre>    <span class="token key atrule">host</span><span class="token punctuation">:</span> localhost</pre></td></tr><tr><td data-num="4"></td><td><pre>    <span class="token key atrule">port</span><span class="token punctuation">:</span> <span class="token number">5672</span></pre></td></tr><tr><td data-num="5"></td><td><pre>    <span class="token key atrule">username</span><span class="token punctuation">:</span> guest</pre></td></tr><tr><td data-num="6"></td><td><pre>    <span class="token key atrule">password</span><span class="token punctuation">:</span> guest</pre></td></tr></table></figure><h2 id="测试-2"><a class="markdownIt-Anchor" href="#测试-2">#</a> 测试</h2>
<figure class="highlight java"><figcaption data-lang="java"></figcaption><table><tr><td data-num="1"></td><td><pre>curl <span class="token operator">-</span><span class="token class-name">X</span> POST <span class="token string">"localhost:3344/actuator/bus-refresh"</span></pre></td></tr><tr><td data-num="2"></td><td><pre>curl <span class="token operator">-</span><span class="token class-name">X</span> POST <span class="token string">"http://localhost:3344/actuator/bus-refresh"</span></pre></td></tr><tr><td data-num="3"></td><td><pre><span class="token comment">// 配置定点通知 就是只通知部分服务，比如只通知 3355, 不通知 3366</span></pre></td></tr><tr><td data-num="4"></td><td><pre><span class="token comment">//** 只通知 3355**</span></pre></td></tr><tr><td data-num="5"></td><td><pre>curl <span class="token operator">-</span><span class="token class-name">X</span> POST <span class="token string">"http://localhost:3344/actuator/bus-refresh/config-client:3355"</span></pre></td></tr></table></figure>
      <div class="tags">
          <a href="/blog/tags/%E5%88%86%E5%B8%83%E5%BC%8F/" rel="tag"><i class="ic i-tag"></i> 分布式</a>
      </div>
  </div>

   <footer>

    <div class="meta">
  <span class="item">
    <span class="icon">
      <i class="ic i-calendar-check"></i>
    </span>
    <span class="text">更新于</span>
    <time title="修改时间：2020-12-24 19:12:29" itemprop="dateModified" datetime="2020-12-24T19:12:29+08:00">2020-12-24</time>
  </span>
  <span id="2020/12/24/Spring Config+Bus/" class="item leancloud_visitors" data-flag-title="Spring Config+Bus" title="阅读次数">
      <span class="icon">
        <i class="ic i-eye"></i>
      </span>
      <span class="text">阅读次数</span>
      <span class="leancloud-visitors-count"></span>
      <span class="text">次</span>
  </span>
</div>

      
<div class="reward">
  <button><i class="ic i-heartbeat"></i> 赞赏</button>
  <p>请我喝[茶]~(￣▽￣)~*</p>
  <div id="qr">
      
      <div>
        <img data-src="/blog/images/wechatpay.png" alt="杜朝宇 微信支付">
        <p>微信支付</p>
      </div>
      
      <div>
        <img data-src="/blog/images/alipay.png" alt="杜朝宇 支付宝">
        <p>支付宝</p>
      </div>
      
      <div>
        <img data-src="/blog/images/paypal.png" alt="杜朝宇 贝宝">
        <p>贝宝</p>
      </div>
  </div>
</div>

      

<div id="copyright">
<ul>
  <li class="author">
    <strong>本文作者： </strong>杜朝宇 <i class="ic i-at"><em>@</em></i>凡尘一叶
  </li>
  <li class="link">
    <strong>本文链接：</strong>
    <a href="http://fyduyu.gitee.io/blog/2020/12/24/Spring%20Config+Bus/" title="Spring Config+Bus">http://fyduyu.gitee.io/blog/2020/12/24/Spring Config+Bus/</a>
  </li>
  <li class="license">
    <strong>版权声明： </strong>本站所有文章除特别声明外，均采用 <span class="exturl" data-url="aHR0cHM6Ly9jcmVhdGl2ZWNvbW1vbnMub3JnL2xpY2Vuc2VzL2J5LW5jLXNhLzQuMC9kZWVkLnpo"><i class="ic i-creative-commons"><em>(CC)</em></i>BY-NC-SA</span> 许可协议。转载请注明出处！
  </li>
</ul>
</div>

  </footer>

</article>

  </div>
  

<div class="post-nav">
    <div class="item left">
      

  <a href="/blog/2020/12/24/gateway/" itemprop="url" rel="prev" data-background-image="https:&#x2F;&#x2F;tva4.sinaimg.cn&#x2F;mw690&#x2F;6833939bly1giciub8ja1j20zk0m81ky.jpg" title="gateway">
  <span class="type">上一篇</span>
  <span class="category"><i class="ic i-flag"></i> SpringCloud</span>
  <h3>gateway</h3>
  </a>

    </div>
    <div class="item right">
      

  <a href="/blog/2020/12/24/Spring%20Cloud%20Stream/" itemprop="url" rel="next" data-background-image="https:&#x2F;&#x2F;tva4.sinaimg.cn&#x2F;mw690&#x2F;6833939bly1gipevuctzzj20zk0m84qp.jpg" title="Spring Cloud Stream">
  <span class="type">下一篇</span>
  <span class="category"><i class="ic i-flag"></i> SpringCloud</span>
  <h3>Spring Cloud Stream</h3>
  </a>

    </div>
</div>

  
  <div class="wrap" id="comments"></div>


        </div>
        <div id="sidebar">
          

<div class="inner">

  <div class="panels">
    <div class="inner">
      <div class="contents panel pjax" data-title="文章目录">
          <ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#spring-config%E5%88%86%E5%B8%83%E5%BC%8F%E9%85%8D%E7%BD%AE%E4%B8%AD%E5%BF%83"><span class="toc-number">1.</span> <span class="toc-text"> Spring Config 分布式配置中心</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8%E9%85%8D%E7%BD%AE%E4%B8%AD%E5%BF%83"><span class="toc-number">2.</span> <span class="toc-text"> 使用配置中心:</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8%E7%A0%81%E4%BA%91%E4%BD%9C%E4%B8%BA%E9%85%8D%E7%BD%AE%E4%B8%AD%E5%BF%83%E7%9A%84%E4%BB%93%E5%BA%93"><span class="toc-number">2.1.</span> <span class="toc-text"> 使用码云作为配置中心的仓库:</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%88%9D%E5%A7%8B%E5%8C%96git%E7%8E%AF%E5%A2%83"><span class="toc-number">2.1.1.</span> <span class="toc-text"> 初始化 git 环境:</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%96%B0%E5%BB%BAconfig%E6%A8%A1%E5%9D%97"><span class="toc-number">2.1.2.</span> <span class="toc-text"> 新建 config 模块:</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#pom"><span class="toc-number">2.1.3.</span> <span class="toc-text"> pom</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6"><span class="toc-number">2.1.4.</span> <span class="toc-text"> 配置文件</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E4%B8%BB%E5%90%AF%E5%8A%A8%E7%B1%BB"><span class="toc-number">2.1.5.</span> <span class="toc-text"> 主启动类</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E9%85%8D%E7%BD%AE%E5%AE%8C%E6%88%90"><span class="toc-number">2.1.6.</span> <span class="toc-text"> 配置完成</span></a></li></ol></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%88%9B%E5%BB%BA%E9%85%8D%E7%BD%AE%E4%B8%AD%E5%BF%83%E5%AE%A2%E6%88%B7%E7%AB%AF"><span class="toc-number">3.</span> <span class="toc-text"> 创建配置中心客户端:</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%88%9B%E5%BB%BAconfig%E5%AE%A2%E6%88%B7%E7%AB%AF%E9%A1%B9%E7%9B%AE"><span class="toc-number">3.1.</span> <span class="toc-text"> 创建 config 客户端项目</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#pom-2"><span class="toc-number">3.2.</span> <span class="toc-text"> pom</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6-2"><span class="toc-number">3.3.</span> <span class="toc-text"> 配置文件</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%B8%BB%E5%90%AF%E5%8A%A8%E7%B1%BB-2"><span class="toc-number">3.4.</span> <span class="toc-text"> 主启动类</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#controller%E7%B1%BB"><span class="toc-number">3.5.</span> <span class="toc-text"> controller 类</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%B5%8B%E8%AF%95"><span class="toc-number">3.6.</span> <span class="toc-text"> 测试</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%AE%9E%E7%8E%B0%E5%8A%A8%E6%80%81%E5%88%B7%E6%96%B0"><span class="toc-number">3.7.</span> <span class="toc-text"> 实现动态刷新</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E4%BF%AE%E6%94%B93355%E6%B7%BB%E5%8A%A0%E4%B8%80%E4%B8%AApom%E4%BE%9D%E8%B5%96"><span class="toc-number">3.7.1.</span> <span class="toc-text"> 修改 3355, 添加一个 pom 依赖</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E4%BF%AE%E6%94%B9%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6%E6%B7%BB%E5%8A%A0%E4%B8%80%E4%B8%AA%E9%85%8D%E7%BD%AE"><span class="toc-number">3.7.2.</span> <span class="toc-text"> 修改配置文件，添加一个配置</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E4%BF%AE%E6%94%B9controller"><span class="toc-number">3.7.3.</span> <span class="toc-text"> 修改 controller</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%AD%A4%E6%97%B6%E9%87%8D%E5%90%AF%E6%9C%8D%E5%8A%A1"><span class="toc-number">3.7.4.</span> <span class="toc-text"> 此时重启服务</span></a></li></ol></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E6%B6%88%E6%81%AF%E6%80%BB%E7%BA%BF"><span class="toc-number">4.</span> <span class="toc-text"> 消息总线:</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8springcloud-bus"><span class="toc-number">4.1.</span> <span class="toc-text"> 使用 SpringCloud Bus</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E9%85%8D%E7%BD%AE"><span class="toc-number">4.2.</span> <span class="toc-text"> 配置</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E9%85%8D%E7%BD%AE3344%E9%85%8D%E7%BD%AE%E4%B8%AD%E5%BF%83%E6%9C%8D%E5%8A%A1%E7%AB%AF"><span class="toc-number">4.2.1.</span> <span class="toc-text"> 配置 3344 (配置中心服务端)</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%B7%BB%E5%8A%A0pom"><span class="toc-number">4.2.1.1.</span> <span class="toc-text"> 添加 pom</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E4%BF%AE%E6%94%B9%E6%9C%8D%E5%8A%A1%E7%AB%AF%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6"><span class="toc-number">4.2.1.2.</span> <span class="toc-text"> 修改服务端配置文件</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E4%BF%AE%E6%94%B9%E5%AE%A2%E6%88%B7%E7%AB%AF%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6"><span class="toc-number">4.2.2.</span> <span class="toc-text"> 修改客户端配置文件</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#%E6%B7%BB%E5%8A%A0pom-2"><span class="toc-number">4.2.2.1.</span> <span class="toc-text"> 添加 pom</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6-3"><span class="toc-number">4.2.2.2.</span> <span class="toc-text"> 配置文件</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%B5%8B%E8%AF%95-2"><span class="toc-number">4.3.</span> <span class="toc-text"> 测试</span></a></li></ol></li></ol>
      </div>
      <div class="related panel pjax" data-title="系列文章">
        <ul>
          <li><a href="/blog/2020/12/24/Hystrix/" rel="bookmark" title="Hystrix">Hystrix</a></li><li><a href="/blog/2020/12/24/gateway/" rel="bookmark" title="gateway">gateway</a></li><li class="active"><a href="/blog/2020/12/24/Spring%20Config+Bus/" rel="bookmark" title="Spring Config+Bus">Spring Config+Bus</a></li><li><a href="/blog/2020/12/24/Spring%20Cloud%20Stream/" rel="bookmark" title="Spring Cloud Stream">Spring Cloud Stream</a></li><li><a href="/blog/2020/12/24/Spring%20Cloud%20sleuth/" rel="bookmark" title="Spring Cloud sleuth">Spring Cloud sleuth</a></li>
        </ul>
      </div>
      <div class="overview panel" data-title="站点概览">
        <div class="author" itemprop="author" itemscope itemtype="http://schema.org/Person">
  <img class="image" itemprop="image" alt="杜朝宇"
      data-src="/blog/images/touxiang.jpg">
  <p class="name" itemprop="name">杜朝宇</p>
  <div class="description" itemprop="description">个人博客&编程笔记</div>
</div>

<nav class="state">
    <div class="item posts">
      <a href="/blog/archives/">
        <span class="count">8</span>
        <span class="name">文章</span>
      </a>
    </div>
    <div class="item categories">
      <a href="/blog/categories/">
        <span class="count">4</span>
        <span class="name">分类</span>
      </a>
    </div>
    <div class="item tags">
      <a href="/blog/tags/">
        <span class="count">2</span>
        <span class="name">标签</span>
      </a>
    </div>
</nav>

<div class="social">
</div>

<ul class="menu">
  
    
  <li class="item">
    <a href="/blog/" rel="section"><i class="ic i-home"></i>首页</a>
  </li>

    
  <li class="item">
    <a href="/blog/about/" rel="section"><i class="ic i-user"></i>关于</a>
  </li>

        
  <li class="item dropdown">
      <a href="javascript:void(0);"><i class="ic i-feather"></i>文章</a>
    <ul class="submenu">

        
  <li class="item">
    <a href="/blog/archives/" rel="section"><i class="ic i-list-alt"></i>归档</a>
  </li>

        
  <li class="item">
    <a href="/blog/categories/" rel="section"><i class="ic i-th"></i>分类</a>
  </li>

        
  <li class="item">
    <a href="/blog/tags/" rel="section"><i class="ic i-tags"></i>标签</a>
  </li>

  </ul>
        
  <li class="item dropdown">
      <a href="javascript:void(0);"><i class="ic i-magic"></i>链环</a>
    <ul class="submenu">

        
  <li class="item">
    <a href="/blog/friends/" rel="section"><i class="ic i-heart"></i>友链</a>
  </li>

  </ul>

</ul>

      </div>
    </div>
  </div>

  <ul id="quick">
    <li class="prev pjax">
        <a href="/blog/2020/12/24/gateway/" rel="prev" title="上一篇"><i class="ic i-chevron-left"></i></a>
    </li>
    <li class="up"><i class="ic i-arrow-up"></i></li>
    <li class="down"><i class="ic i-arrow-down"></i></li>
    <li class="next pjax">
        <a href="/blog/2020/12/24/Spring%20Cloud%20Stream/" rel="next" title="下一篇"><i class="ic i-chevron-right"></i></a>
    </li>
    <li class="percent"></li>
  </ul>
</div>


        </div>
        <div class="dimmer"></div>
      </div>
    </main>
    <footer id="footer">
      <div class="inner">
        <div class="widgets">
          
<div class="rpost pjax">
  <h2>随机文章</h2>
  <ul>
      
  <li class="item">
    
<div class="breadcrumb">
<a href="/blog/categories/%E5%BC%80%E6%BA%90%E9%A1%B9%E7%9B%AE%E7%AC%94%E8%AE%B0/" title="分类于 开源项目笔记">开源项目笔记</a>
</div>

    <span><a href="/blog/2020/12/23/moti%E5%BC%80%E6%BA%90%E5%AD%A6%E5%88%B0%E7%9A%84/" title="moti">moti</a></span>
  </li>

      
  <li class="item">
    
<div class="breadcrumb">
<a href="/blog/categories/java/" title="分类于 java">java</a>
</div>

    <span><a href="/blog/2020/12/23/Druid%E9%85%8D%E7%BD%AE/" title="Druid配置">Druid配置</a></span>
  </li>

      
  <li class="item">
    
<div class="breadcrumb">
<a href="/blog/categories/SpringCloud/" title="分类于 SpringCloud">SpringCloud</a>
</div>

    <span><a href="/blog/2020/12/24/Spring%20Cloud%20sleuth/" title="Spring Cloud sleuth">Spring Cloud sleuth</a></span>
  </li>

      
  <li class="item">
    
<div class="breadcrumb">
<a href="/blog/categories/SpringCloud/" title="分类于 SpringCloud">SpringCloud</a>
</div>

    <span><a href="/blog/2020/12/24/gateway/" title="gateway">gateway</a></span>
  </li>

      
  <li class="item">
    
<div class="breadcrumb">
<a href="/blog/categories/SpringCloud/" title="分类于 SpringCloud">SpringCloud</a>
</div>

    <span><a href="/blog/2020/12/24/Spring%20Cloud%20Stream/" title="Spring Cloud Stream">Spring Cloud Stream</a></span>
  </li>

      
  <li class="item">
    
<div class="breadcrumb">
<a href="/blog/categories/SpringCloud/" title="分类于 SpringCloud">SpringCloud</a>
</div>

    <span><a href="/blog/2020/12/24/Hystrix/" title="Hystrix">Hystrix</a></span>
  </li>

      
  <li class="item">
    
<div class="breadcrumb">
<a href="/blog/categories/Spring-Cloud-Alibaba/" title="分类于 Spring Cloud Alibaba">Spring Cloud Alibaba</a>
</div>

    <span><a href="/blog/2020/12/24/Nacos/" title="Cloud Alibaba Nacos">Cloud Alibaba Nacos</a></span>
  </li>

      
  <li class="item">
    
<div class="breadcrumb">
<a href="/blog/categories/SpringCloud/" title="分类于 SpringCloud">SpringCloud</a>
</div>

    <span><a href="/blog/2020/12/24/Spring%20Config+Bus/" title="Spring Config+Bus">Spring Config+Bus</a></span>
  </li>

  </ul>
</div>
<div>
  <h2>最新评论</h2>
  <ul class="leancloud-recent-comment"></ul>
</div>

        </div>
        <div class="status">
  <div class="copyright">
    
    &copy; 2010 – 
    <span itemprop="copyrightYear">2020</span>
    <span class="with-love">
      <i class="ic i-sakura rotate"></i>
    </span>
    <span class="author" itemprop="copyrightHolder">杜朝宇 @ blog</span>
  </div>
  <div class="count">
    <span class="post-meta-item-icon">
      <i class="ic i-chart-area"></i>
    </span>
    <span title="站点总字数">42k 字</span>

    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="ic i-coffee"></i>
    </span>
    <span title="站点阅读时长">38 分钟</span>
  </div>
  <div class="powered-by">
    基于 <span class="exturl" data-url="aHR0cHM6Ly9oZXhvLmlv">Hexo</span> & Theme.<span class="exturl" data-url="aHR0cHM6Ly9naXRodWIuY29tL2FtZWhpbWUvaGV4by10aGVtZS1zaG9rYQ==">Shoka</span>
  </div>
</div>

      </div>
    </footer>
  </div>
<script data-config type="text/javascript">
  var LOCAL = {
    path: '2020/12/24/Spring Config+Bus/',
    favicon: {
      show: "（●´3｀●）やれやれだぜ",
      hide: "(´Д｀)大変だ！"
    },
    search : {
      placeholder: "文章搜索",
      empty: "关于 「 ${query} 」，什么也没搜到",
      stats: "${time} ms 内找到 ${hits} 条结果"
    },
    valine: true,fancybox: true,copyright: '复制成功，转载请遵守 <i class="ic i-creative-commons"></i>BY-NC-SA 协议。',
    ignores : [
      function(uri) {
        return uri.includes('#');
      },
      function(uri) {
        return new RegExp(LOCAL.path+"$").test(uri);
      }
    ]
  };
</script>

<script src="https://cdn.polyfill.io/v2/polyfill.js"></script>

<script src="//cdn.jsdelivr.net/combine/npm/pace-js@1.0.2/pace.min.js,npm/pjax@0.2.8/pjax.min.js,npm/whatwg-fetch@3.4.0/dist/fetch.umd.min.js,npm/animejs@3.2.0/lib/anime.min.js,npm/algoliasearch@4/dist/algoliasearch-lite.umd.js,npm/instantsearch.js@4/dist/instantsearch.production.min.js,npm/lozad@1/dist/lozad.min.js,npm/quicklink@2/dist/quicklink.umd.js"></script>

<script src="/blog/js/app.js?v=0.2.5"></script>




</body>
</html>
